<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="root">

    </div>
    <script src="../js/vue.js"></script>
    <script>
            Vue.config.productionTip=false//阻止vue启动时产生提示
            const student=Vue.extend({
                template:`
                <div>
                    <h2>学生名称:{{name}}</h2>
                    <h2>学生年龄:{{age}}</h2>

                </div>
                `,
                data(){
                    return{
                        name:'张三',
                        age:30
                    }
                }
            })
            //定义一个school组件
            const school=Vue.extend({
                //el: "#root", //一定不要写el配置项，因为最终所有的组件都要被vm管理由vm决定服务于谁
                template: `
                    <div>
                    <h2>学校名称:{{schoolName}}</h2>
                    <h2>学校地址:{{address}}</h2>
                        <student></student>
                    </div>`,
                data(){
                    return{
                        schoolName:'尚硅谷',
                        address:'北京'
                    }
                },
                components:{
                    student
                }
            })
            //定义一个hello组件
            const hello=Vue.extend({
                template:`
                <div>
                <h1>{{msg}}</h1>
                </div>
                `,
                data(){
                    return{
                        msg:'欢迎来到vue学习',
                    }
                }
            })

            //定义app组件
            const app=Vue.extend({
                template:`
                <div>
                    <hello></hello>
                    <school></school>
                </div>
                `,
                components:{
                    school,
                    hello
                }
            })
            new Vue({
                 el: "#root",
                template:`
                        <app></app>
                `,
                 data:{//数据
                      name:'',

                    },
                 methods:{//方法

                 },
                 computed:{//计算

                 },
                 watch:{//监视

                 },
                 components:{
                     app
                 }
             })
    </script>
</body>
</html>